package o;

import android.annotation.TargetApi;
import android.app.Activity;

import com.huawei.appgallery.foundation.ui.framework.activity.AbstractBaseActivity;
import com.huawei.appmarket.support.emui.permission.BasePermissionActivity;

import o.dky.j;

public class NetWorkUtls {
    private BaseAlertDialog mDialog;

    @TargetApi(24)
    static class a implements cks {
        private Activity mContext;
        private boolean hasRequesPermission;
        private int permissionCode;

        public a(Activity activity, int permissonCode, boolean hasReqeustNetWork) {
            this.mContext = activity;
            this.permissionCode = permissonCode;
            this.hasRequesPermission = hasReqeustNetWork;
        }

        public void enableNetworking() {
            if (this.hasRequesPermission) {
                this.mContext.requestPermissions(PermissionChecker.getPermissionString(this.permissionCode), this.permissionCode);
                return;
            }
            try {
                NetWorkUtil.setWIfi(this.mContext.getApplicationContext(), ContentManager.getInstant().getContext().getPackageName());
            } catch (Exception e) {
                Logger.ˎ("mainactivity", "startActivity MANAGE_APP_PERMISSIONS failed! e = " + e.getMessage());
            }
            AbstractBaseActivity.sendUpgrade(this.mContext);
            if (this.mContext instanceof BasePermissionActivity) {
                this.mContext.finish();
            }
        }

        public void upgrade() {
            AbstractBaseActivity.sendUpgrade(this.mContext);
            if (this.mContext instanceof BasePermissionActivity) {
                this.mContext.finish();
            }
        }

        public void ˋ() {
        }
    }

    public void showDial(Activity activity, boolean z, int i, int i2) {
        this.mDialog = BaseAlertDialog.ˋ(activity, activity.getString(j.ॱˊ), activity.getString(i));
        this.mDialog.ॱ();
        this.mDialog.ˎ(false);
        this.mDialog.ॱ(o.ckr.a.CONFIRM, j.ᐧ);
        this.mDialog.ॱ(o.ckr.a.CANCEL, j.ᐝˋ);
        this.mDialog.ˎ(new a(activity, i2, z));
    }

    public void dismiss() {
        if (this.mDialog != null) {
            this.mDialog.ˏ();
        }
    }

    public boolean isShowing() {
        if (this.mDialog != null) {
            return this.mDialog.ˎ();
        }
        return false;
    }
}
